<!DOCTYPE html>
<html>
	<head>
		<title>Mono for NaCl project.</title>
	</head>
	
	<body>
		<object id="plugin" width="512" height="512" src="main.nmf" type="application/x-nacl"></object>
		
		<script type="text/javascript">
			var plugin = document.getElementById('plugin');
			
			handleMessage = function(message)
			{
				if (message.data === 'Mono Initialized')
				{
					document.getElementById('status').innerHTML = 'Mono Initialized';
					plugin.postMessage('LoadAssemblyDlls');
				}
				else if (message.data === 'Mono Loaded Dlls')
				{
					document.getElementById('status').innerHTML = 'Mono Loaded Dlls';
					plugin.postMessage('LoadAssemblyExe');
				}
				else if (message.data === 'Mono Loaded Exe')
				{
					document.getElementById('status').innerHTML = 'Mono Loaded Exe';
					plugin.postMessage('ExecuteAssembly');
				}
				else if (message.data === 'Mono Executed Exe')
				{
					document.getElementById('status').innerHTML = 'Mono Executed Exe';
				}
				else
				{
					document.getElementById('output').innerHTML += message.data + '<br>';
				}
			}
			plugin.addEventListener('message', handleMessage, true);
		</script>
		
		<h1>Mono for NaCl project</h1>
		<p>Native client will boot up mono and WaterDemo_NaCl.exe, then WaterDemo_NaCl.exe will invoke the 'HelloWorld" method build directly into "WaterDemo_NaCl_x86_(32/64).nexe" and send back its responce to javaScript.</p>
		<h2>STATUS</h2>
		<div id="status">NOT READY</div>
		<h2>OUTPUT</h2>
		<br><div id="output"></div>
	</body>
</html>


